8a2842fc02a70a076ae18bf85ceed9faed61a9c3,source/org/jasig/portal/utils/RDBMCounterStore.java,RDBMCounterStore,createCounter,#String#,56

Before Change


            Statement stmt = con.createStatement();
            try {
                String sInsert = "INSERT INTO UP_SEQUENCE (SEQUENCE_NAME,SEQUENCE_VALUE) VALUES ('" + counterName + "',0)";
                LogService.log(LogService.DEBUG, "RDBMUserLayoutStore::createCounter(): " + sInsert);
                stmt.executeUpdate(sInsert);
                RDBMServices.commit(con);
            } catch (Exception e) {

After Change


            RDBMServices.setAutoCommit(con, false);
            
            String createCounterInsert =
                "INSERT INTO UP_SEQUENCE (SEQUENCE_NAME, SEQUENCE_VALUE) " +
                "VALUES (?, 0)";
            
            createCounterPstmt = con.prepareStatement(createCounterInsert);
            createCounterPstmt.setString(1, counterName);
            
            LogService.log(LogService.DEBUG, "RDBMCounterStore::createCounter(" + counterName + "): " + createCounterInsert);
            int updateCount = createCounterPstmt.executeUpdate();
            
            if (updateCount <= 0) {
                PortalException pe = new PortalException("RDBMCounterStore::createCounter(): An error occured while creating the counter named: " + counterName + ".\nNo rows were created.");
                LogService.log(LogService.ERROR, pe); 
                throw pe;
            }
            
            RDBMServices.commit(con);
        }
        catch (SQLException sqle) {
            RDBMServices.rollback(con);
            
            PortalException pe = new PortalException("RDBMCounterStore::createCounter(): An error occured while creating the counter named: " + counterName, sqle);
            LogService.log(LogService.ERROR, pe); 
            throw pe;
        } 
        finally {